package com.itheima.stock.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@HeadRowHeight(value = 35) // 表头行高
@ContentRowHeight(value = 25) // 内容行高
@ColumnWidth(value = 50) // 列宽
public class User {
//    private String userName;
//    private Integer age;
//    private String address;
//    private Date birthday;

//自定义表头
//@ExcelProperty(value = {"用户名"},index = 1)
//private String userName;
//    @ExcelProperty(value = {"年龄"},index = 2)
//    private Integer age;
//    @ExcelProperty(value = {"地址"} ,index = 4)
//    private String address;
//    @ExcelProperty(value = {"生日"},index = 3)
//    private Date birthday;

//自定义日期
//    @ExcelProperty(value = {"用户名"},index = 1)
//    private String userName;
//    @ExcelProperty(value = {"年龄"},index = 2)
//    private Integer age;
//    @ExcelProperty(value = {"地址"} ,index = 4)
//    private String address;
//    @ExcelProperty(value = {"生日"},index = 3)
//    //注意：日期格式注解由alibaba.excel提供
//    @DateTimeFormat("yyyy/MM/dd HH:mm")
//    private Date birthday;

//合并表头
//    @ExcelProperty(value = {"用户基本信息","用户名"},index = 1)
//    private String userName;
//    @ExcelProperty(value = {"用户基本信息","年龄"},index = 2)
//    private Integer age;
//    @ExcelProperty(value = {"用户基本信息","地址"} ,index = 4)
//    private String address;
//    @ExcelProperty(value = {"用户基本信息","生日"},index = 3)
//    //注意：日期格式注解由alibaba.excel提供
//    @DateTimeFormat("yyyy/MM/dd HH:mm")
//    private Date birthday;

//忽略指定表头信息
    @ExcelProperty(value = {"用户基本信息","用户名"},index = 1)
    @ExcelIgnore
    private String userName;
    @ExcelProperty(value = {"用户基本信息","年龄"},index = 2)
    private Integer age;
    @ExcelProperty(value = {"用户基本信息","地址"} ,index = 4)
    private String address;
    @ExcelProperty(value = {"用户基本信息","生日"},index = 3)
    //注意：日期格式注解由alibaba.excel提供
    @DateTimeFormat("yyyy/MM/dd HH:mm")
    private Date birthday;
}
